package com.gxa.admin.controller;

import com.gxa.common.vo.PageRecv;
import com.gxa.common.vo.R;
import com.gxa.common.vo.ResultVo;
import com.gxa.modules.pojo.Loan;
import com.gxa.modules.pojo.LoanSearch;
import com.gxa.modules.pojo.Loan_Processing;
import com.gxa.modules.service.GiveLoanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: microloans_system
 * @description: 放款
 * @author: LC
 * @create: 2021-12-30 16:47
 */


@Api(value = "放款管理接口",tags = "（李晨）放款管理接口")
@RestController
@RequestMapping("/giveLoan")
public class GiveLoanController {

    @Autowired(required = false)
    GiveLoanService giveLoanService;



    @ApiOperation(value = "修改放款通道", notes = "修改放款通道", response = ResultVo.class)
    @PostMapping("/modifyLoanChannel")
    public ResultVo modifyLoanChannel(@RequestBody Loan loan){
        ResultVo r = giveLoanService.modifyLoanChannel(loan);
        return r;
    }



    @ApiOperation(value = "查询放款审批", notes = "分页和条件查询", response = R.class)
    @PostMapping("/getGiveLoanReviewPageInfoByCondition")
    public ResultVo getGiveLoanReviewPageInfoByCondition(@RequestBody PageRecv<LoanSearch> loanSearchPageRecv){
        ResultVo r = giveLoanService.getGiveLoanReviewPageInfoByCondition(loanSearchPageRecv);
        return r;
    }

    @ApiOperation(value = "查询放款处理", notes = "分页和条件查询", response = R.class)
    @PostMapping("/getLoanProcessingPageInfoByCondition")
    public ResultVo getLoanProcessingPageInfoByCondition(@RequestBody PageRecv<LoanSearch> loanSearchPageRecv){
        ResultVo r = giveLoanService.getLoanProcessingPageInfoByCondition(loanSearchPageRecv);
        return r;
    }


    @ApiOperation(value = "放款", notes = "放款", response = ResultVo.class)
    @PostMapping("/giveLoan")
    public ResultVo giveLoan(@RequestBody Loan_Processing loan_processing){
        ResultVo r = giveLoanService.giveLoan(loan_processing);
        return r;
    }

    @ApiOperation(value = "委托放款", notes = "委托放款", response = ResultVo.class)
    @PostMapping("/entrustLoan")
    public ResultVo entrustLoan(@RequestBody Loan_Processing loan_processing){
        ResultVo r = giveLoanService.entrustLoan(loan_processing);
        return r;
    }



}